package com.ruoyi.security.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.security.mapper.AfMonitoringMapper;
import com.ruoyi.security.domain.AfMonitoring;
import com.ruoyi.security.service.IAfMonitoringService;

/**
 * 视频监控Service业务层处理
 *
 * @author Felix
 * @date 2021-10-12
 */
@Service
public class AfMonitoringServiceImpl implements IAfMonitoringService {
    @Autowired
    private AfMonitoringMapper afMonitoringMapper;

    /**
     * 查询视频监控
     *
     * @param id 视频监控ID
     * @return 视频监控
     */
    @Override
    public AfMonitoring selectAfMonitoringById(String id) {
        return afMonitoringMapper.selectAfMonitoringById(id);
    }

    /**
     * 查询视频监控列表
     *
     * @param afMonitoring 视频监控
     * @return 视频监控
     */
    @Override
    public List<AfMonitoring> selectAfMonitoringList(AfMonitoring afMonitoring) {
        return afMonitoringMapper.selectAfMonitoringList(afMonitoring);
    }

    /**
     * 新增视频监控
     *
     * @param afMonitoring 视频监控
     * @return 结果
     */
    @Override
    public int insertAfMonitoring(AfMonitoring afMonitoring) {
        afMonitoring.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        afMonitoring.setCreateTime(DateUtils.getNowDate());
        afMonitoring.setCreateBy(SecurityUtils.getUsername());
        return afMonitoringMapper.insertAfMonitoring(afMonitoring);
    }

    /**
     * 修改视频监控
     *
     * @param afMonitoring 视频监控
     * @return 结果
     */
    @Override
    public int updateAfMonitoring(AfMonitoring afMonitoring) {
        afMonitoring.setUpdateTime(DateUtils.getNowDate());
        afMonitoring.setUpdateBy(SecurityUtils.getUsername());
        return afMonitoringMapper.updateAfMonitoring(afMonitoring);
    }

    /**
     * 批量删除视频监控
     *
     * @param ids 需要删除的视频监控ID
     * @return 结果
     */
    @Override
    public int deleteAfMonitoringByIds(String[] ids) {
        return afMonitoringMapper.deleteAfMonitoringByIds(ids);
    }

    /**
     * 删除视频监控信息
     *
     * @param id 视频监控ID
     * @return 结果
     */
    @Override
    public int deleteAfMonitoringById(String id) {
        return afMonitoringMapper.deleteAfMonitoringById(id);
    }
}
